if not _P then
    print("hotfix fail, no _P define")
    return
end

print("hotfix begin")

-- 用于获取函数变量
local function get_up(f)
    local u = {}
    if not f then
        return u
    end
    local i = 1
    while true do
        local name, value = debug.getupvalue(f, i)
        if name == nil then
            return u
        end
        u[name] = value
        i = i + 1
    end
    return u
end

-- 获取原来的函数地址，及函数变量
local command = _P.lua.command
local upvs = get_up(command.do_test)
local test = upvs.test

command.do_test = function(msg)
    test('New ' .. msg)
end

print("hotfix end")